home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr51
/
fastpack.zip
/
FASTPACK.DOC
< prev
next >
Wrap
Text File
|
1993-04-04
|
8KB
|
146 lines
*** Fastpack ***
Contents of Fastpack.zip:
Fastpack.doc, this ASCII file of explanation.
Fastpack.asm, ASCII file of assembler source code.
Fastpack.bin, binary file to run within dBASE by LOAD . . . CALL--
Syntax: CALL Fastpack WITH <filespec> [/N] [/T] && See below
Fastpack.com, binary file to run from DOS prompt--
Syntax: Fastpack <filespec> [/N] [/T]
where <filespec> specifies the file to pack.
The [/N] (No-backup) option, if included, specifies an in-place pack.
Without /N, the original file will be kept and renamed .bak.
The [/T] (Terse) option suppresses screen display of progress.
Without /T, a running report of records copied will be displayed.
*** What it is ***
Fastpack is a utility to pack dBASE files quickly. It works on dBASE III+ and
dBASE IV files, but has not been tested on purportedly compatible files
created with other products.
Fastpack was written by R. Russell Freeland for the book "dBASE Power: Building
and Using Programming Tools", by P. L. Olympia, R. Russell Freeland and Randy
Wallin, published and copyright by Ashton-Tate Corporation, 1988.
The present version was modified by Jay Parsons, December, 1989 as follows:
1) Pack-then-write algorithm implemented, which improves speed for
records of small size relative to the buffer.
2) Only one screen write of progress per buffer.
3) Header of packed file updated to current date.
4) Packed file given original extension.
5) Assembly option for runnable .exe and .com files added.
6) Assembly option for 80386 and related instructions added.
7) Command/assembly option for no screen writing added.
8) Command/assembly option for no backup file added.
9) Numerous insignificant changes due to programmer style.
Republished by permission of Ashton-Tate Corporation. Modifications placed
in the public domain December, 1989.
*** How It Works ***
Fastpack does the same thing as the dBASE PACK command. It removes records
marked for deletion from dBASE files. It usually works much faster. However,
it runs within, but does not use, dBASE. Do not attempt to pack a file in
USE in dBASE, because Fastpack will change the file but not dBASE's information
about it, causing serious problems including apparent loss of data and index
corruption. Close the file first.
Also, Fastpack does not automatically reindex the file as the native PACK
command does. Issue the appropriate REINDEX commands after Fastpack runs.
If an error (disk full, for example) occurs, Fastpack will return an error
code. The .com version returns it as the DOS errorlevel, the .bin as the
first character of the argument at the call. When using the .bin,
the argument of filespec and any switches must be placed in a variable,
not given as a literal, if dBASE is to be able to access the error code.
For example:
Arg = "myfile /T"
CALL Fastpack WITH Arg
? val(Arg)
*----------------------------------------------------------------------------
For the most complete explanation, PLEASE see the source code, Fastpack.asm.
*----------------------------------------------------------------------------
The source code contains several assembly options, through which the code
may be configured to produce 72 slightly different programs. If you don't
have an assembler, you won't be able to select among them, but read on to
learn how they work.
The major options are:
1) To create a program that runs from the DOS prompt outside dBASE,
as a .COM file, instead of one that runs as a .BIN. Both options are found in
the included files Fastpack.com and Fastpack.bin, so if you don't have an
assembler, you may still choose and use either one. In either case, the
options ( /N, /T ) may be specified following the filespec of the file to pack.
2) /N To create a program that does or does not create a backup (.bak)
file of the packed file. With the /N option off (default), the file is packed
to a new file. After successful packing, the new file is given the original
name and the original file is given the .bak extension. This slows down the
operation of the program significantly for large files due to repeated calls to
DOS to obtain additional disk clusters for the new (packed) file. Worse, this
will not work at all unless there is sufficient disk space for both the
new file containing the undeleted records of the old and the old file. If the
/N option is on, the program works like the dBASE PACK command, packing the old
file "in place". This saves disk space and time but risks data loss.
This option is implemented as a three-way assembly option. The program
may be assembled always to create a new file, always to pack in place or to
accept a runtime parameter specifying which way to pack. Using this last
option, the program creates a new file unless the "/N" switch is included.
The included .com and .bin files both accept the runtime /N option. If "/N"
is not included, they will create a new file and rename the old.
Minor options are:
3) /T Whether or not to print progress reports to the screen. While
interesting, such reports are undesirable in developed systems. A three-way
assembly option permits choice among no reports, always reports or acceptance
of a runtime parameter, the /T switch. The included .bin and .com files accept
the switch. If it is NOT included, reports are printed to the screen. If the
switch is included, the program creates no visible output, more or less as if
TALK was SET to OFF.
4) Whether the program uses processor instructions specific to the
80386 processor, gaining a small amount of speed at the expense of being in-
compatible with earlier processors. The default is no.
5) Whether the program can be debugged by starting dBASE with the DOS
command "DEBUG dBASE Fastpack <filespec>". If included, this option includes
a line to give control to DEBUG when the program starts. The default is no.
In addition, the size of the buffer (area of memory into which records
of the file being packed will be read) may be changed. This applies only if
the selection at option (1) has been to create a .bin file that can be run
within dBASE. The .bin file created by option 1 uses only memory internal to
itself, so if it can LOAD, it can be CALLed. Increasing its buffer size (the
default is 12,288 bytes) may speed operation, particularly if the file being
packed has large records. The program loads as many records at once as can
fit in its buffer, so if each record required 4,000 bytes (the specified
maximum for dBASE IV) an increase of the buffer to 16,000 bytes would
eliminate 1/4 of the disk read accesses and provide a significant increase in
speed.
If the selection at option (1) was to create a .com file, it will grab
a whole 64K segment of memory as its buffer. This assumes there is at least
one full segment available, which is reasonably safe if the program is run
outside dBASE. It cannot be guaranteed that enough memory will be available if
the .com file is run within a future release of dBASE using the !/RUN command,
and the program does not check on memory available, so it is recommended that
the .com version be run only from DOS outside dBASE, not through RUN.
*** Problems ***
Please do not call Russ Freeland in the event of any problems with these
programs. Report any difficulties or bugs to Jay Parsons, AT-BBS Jparsons,
CIS 70160,340, (201) 766-5845.